home *** CD-ROM | disk | FTP | other *** search
File List | 1990-01-16 | 8.0 KB | 260 lines |
- '
- ' Saved as: NAMEDROP.BAS or NAMEDROP.LST
- '
- ' -----------------------------------------------------------------------------
- '
- ' NAMEDROPPER
- ' -------------
- ' version 1.1
- '
- '
- ' DISK VOLUME LABEL READER/CHANGER
- '
- ' This program is designed to find the volume label present on a
- ' floppy disk and change or delete it as required. This is not
- ' possible under the normal GEM desktop.
- '
- ' This program will run, ask for the correct drive to access,
- ' inform you if the disk in that drive has a Volume label, and
- ' enables you to change or delete it.
- '
- ' The program runs in LOW, MEDIUM, and HIGH resolutions.
- '
- '
- ' (c) Copyright 1990 by Antic Publishing, Inc.
- '
- ' Written by
- ' Al Hubbard Mississauga, ONT
- ' GEnie - A.HUBBARD1
- '
- ' ENJOY
- '
- ' ------------------------------------------------------------------------------
- '
- Res%=Xbios(4) ! First we check the resolution,
- C%=2 ! and set up for HIGH resolution,
- D%=150
- If Res%=0 ! but change the variables to enable
- A%=20 ! us to print properly on the screen
- B%=160 ! if resolution is LOW or MED.
- C%=1
- D%=0
- Endif
- If Res%=1
- C%=1
- D%=0
- Endif
- '
- Deffill 1,2,8 ! Draw top title box.
- Pbox 154-B%,4,460-B%,20*C%
- Pbox 160-B%,0,470-B%,18*C%
- Deffill 0,2,8
- Pbox 162-B%,1,468-B%,17*C%
- Deftext 1,16,0,8*C%
- Text 184-B%,13*C%,"N A M E D R O P P E R"
- '
- Deffill 1,2,8 ! Draw bottom info box.
- Pbox 154-B%,165+D%,460-B%,190+D%
- Pbox 160-B%,163+D%,470-B%,188+D%
- Deffill 0,2,8
- Pbox 162-B%,164+D%,468-B%,187+D%
- Deftext 1,0,0,6
- Text 176-B%,173+D%,"Modify volume labels w/o re-format"
- Text 176-B%,183+D%,"Copyright 1990 by Antic Publishing"
- '
- Start:
- Pbox 160-B%,32*C%,470-B%,88*C% ! Clear between titles only!
- Do
- Dr%=0
- Print At(29-A%,4);"Drive to access (A/B)? ";
- Repeat
- Dr$=Inkey$ ! This section selects the drive to
- Until Dr$<>"" ! access, limiting the selection
- If Dr$="A" Or Dr$="a" ! to drive A or B only.
- Dr%=1
- Endif
- If Dr$="B" Or Dr$="b"
- Dr%=2
- Endif
- Exit If Dr%=1 Or Dr%=2
- Loop
- Print At(52-A%,4);Upper$(Dr$)
- Chdrive Dr% ! Change drive to desired one.
- Chdir "\" ! Change directory to the root.
- Buffer$=Space$(44) ! Set/clear buffer for disk info.
- Void Gemdos(26,L:Varptr(Buffer$)) ! Inform GEMDOS of new DTA buffer.
- B$="*.*" ! Declare ANY file for search,
- Attr%=8 ! with the LABEL attribute.
- Void Gemdos(78,L:Varptr(B$),Attr%) ! Find 1st file fitting above.
- Label$=Left$(Right$(Buffer$,14),12) ! Parse file name only out.
- '
- If Label$=" " ! Indicate if LABEL present
- Print At(22-A%,6);"Disk in DRIVE "+Upper$(Dr$)+" does NOT have a LABEL!"
- Mm$=" Add "
- Else
- Print At(26-A%,6);"LABEL for disk in DRIVE ";Upper$(Dr$)+" Is: "
- Print At((40-A%)-(Len(Label$)/2),8);Label$
- Mm$=" Change "
- Endif
- '
- M$=" What would you like | | to do with the Label? "
- Alert 2,M$,1," Nothing | Delete |"+Mm$,B
- If B=1
- Goto End
- Endif
- If B=2
- Newlabel$=""
- Endif
- If B=3
- Print At(21-A%,6);" "
- Print At(24-A%,8);"LABEL desired (11 characters ONLY!)"
- Print At(34-A%,10);
- '
- Gosub Get_input
- '
- If Newlabel$=""
- Print At(24-A%,8);" New Label NOT selected! "
- Goto End
- Endif
- Endif
- Gosub Do_it
- '
- End:
- M$="Would you like to| |quit the program?"
- Alert 2,M$,1," No | Yes ",B
- If B=2
- Void Gemdos(26,L:Basepage+128) ! Re-establish normal DTA buffer.
- End
- Else
- Goto Start
- Endif
- '
- Procedure Do_it
- If Label$<>" " Or Newlabel$=""
- Void Gemdos(60,L:Varptr(Label$),0) ! Open previous LABEL file with
- ' ! with normal file attribute set.
- Void Gemdos(62,L:Varptr(Label$)) ! Close this file.
- Void Gemdos(65,L:Varptr(Label$)) ! Delete this file (can be deleted
- ' ! because it is now a normal file).
- Endif
- '
- If Newlabel$<>""
- Void Gemdos(60,L:Varptr(Newlabel$),8) ! Open file with new name and
- Void Gemdos(62,L:Varptr(Newlabel$)) ! and then CLOSE the file.
- Endif
- '
- Deffill 0,2,8
- Pbox 160-B%,32*C%,470-B%,88*C%
- If B=2
- Print At(22-A%,6);"Disk in DRIVE "+Upper$(Dr$)+" does NOT have a LABEL!"
- Else
- Print At(26-A%,6);"LABEL for disk in DRIVE ";Upper$(Dr$)+" Is: "
- Print At((40-A%)-(Len(Newlabel$)/2),8);Newlabel$
- Endif
- Return
- '
- Procedure Get_input
- Local Label$,Char$,Test$,Only1%,Xprint%,Yprint%,Y%
- Char$=""
- Label$=""
- Only1%=0
- '
- Xprint%=35-A% ! X position for input line
- Yprint%=10 ! Y position for input line
- Y%=12 ! Amount of characters desired
- '
- Test$="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:#" ! Allowable characters.
- Print At(Xprint%,Yprint%);"________.___"
- Print At(Xprint%,Yprint%);
- For X%=1 To Y%
- Print At(Xprint%-1+X%,Yprint%);"|";
- Lpoke Xbios(14,1)+6,0 ! Clears keyboard buffer.
- Char$=""
- Do
- If Inp?(2) ! Gets 1 character
- Char$=Chr$(Inp(2))
- Endif
- Exit If Char$<>""
- Loop
- If Char$=Chr$(13) ! Stops input when return pressed.
- X%=12
- Char$=""
- Goto Endit
- Endif
- Char$=Upper$(Char$)
- If Instr(Test$,Char$)<>0 ! Tests for allowable characters.
- If Char$="."
- If X%=1 ! First position only.
- Print At(Xprint%,Yprint%);" ";
- Else
- Print At(Xprint%+X%-1,Yprint%);" ";
- Endif
- If Y%=8
- X%=8
- Goto Endit
- Endif
- If Only1%=0 ! Allows period (only 1, though)
- Print String$(9-X%," ")
- Only1%=1
- X%=9
- Label$=Label$+Char$ ! Builds string of these characters.
- Else
- Char$=""
- X%=X%-1
- Endif
- Else
- Label$=Label$+Char$
- Endif
- Print At(Xprint%-1+X%,Yprint%);Char$;
- Else
- Dec X%
- Endif
- If Char$=Chr$(8) ! Backup cursor.
- Dec X%
- If X%>0 ! Not first character.
- If X%=8
- If Right$(Label$,1)="."
- Dec X%
- Endif
- If X%>Instr(Label$,".")-1
- X%=Instr(Label$,".")-1
- Endif
- Label$=Left$(Label$,X%)
- Print At(Xprint%,Yprint%);"________.___"
- Print At(Xprint%,Yprint%);Label$
- Only1%=0
- Else
- Label$=Left$(Label$,Len(Label$)-1)
- Print At(Xprint%+X%,Yprint%);" _";
- Endif
- Goto Endit
- Else
- X%=0 ! Is the first character.
- Label$=""
- Print At(Xprint%+X%,Yprint%);" _";
- Endif
- Endif
- If Len(Label$)=8 Or X%=8
- If Instr(Label$,".")=0
- Inc X%
- Print ".";
- Label$=Label$+"."
- Only1%=1
- Endif
- Endif
- Endit:
- Next X%
- If Right$(Label$,1)="."
- Newlabel$=Left$(Label$,Instr(Label$,".")-1)
- Else
- If Left$(Label$,1)="."
- Newlabel$=Right$(Label$,Len(Label$)-1)
- Else
- Newlabel$=Label$ ! Returns the filename.
- Endif
- Endif
- Return
- '
- ' ------------------------------------------------------------------------------
- '
-